package leetcode.biweekly.week82;

import leetcode.helper.tree.TreeNode;

//Solution1Test
public class Solution1 {
	// Solution1Test
	public boolean evaluateTree(TreeNode root) {
		if (root.left == null && root.right == null) {
			return root.val == 1;
		}

		return root.val == 2 ? this.evaluateTree(root.left) || this.evaluateTree(root.right)
				: this.evaluateTree(root.left) && this.evaluateTree(root.right);
	}

}
